<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="" />
    <meta name="author" content="" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Free Responsive Admin Theme - ZONTAL</title>
    <link href="static/css/bootstrap.css" rel="stylesheet" />
    <link href="static/css/font-awesome.css" rel="stylesheet" />
    <link href="static/css/style.css" rel="stylesheet" />
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
</head>
<body>
<!--<form action="check_class_details" enctype='multipart/form-data' method='POST'>-->
    <!--第一处修改：去掉头部-->
    <div class="navbar navbar-inverse set-radius-zero">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="\index">
                    <img src="static/img/logo.png" />
                </a>
            </div>
            <div class="left-div">
                <div class="user-settings-wrapper">
                    <ul class="nav">
                        <li class="dropdown">
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
                                <span class="glyphicon glyphicon-user" style="font-size: 25px;"></span>
                            </a>
                            <div class="dropdown-menu dropdown-settings">
                                <div class="media">

                                    <div class="media-left" href="#">
                                        {% for m in myself %}
                                        <h4 class="media-heading">{{m[2]}}</h4>
                                    </div>
                                </div>
                                <hr />
                                <h5><strong>基本信息: </strong></h5>
                                <p name="adm_username" id="adm_username">工号：{{m[0]}}</p>
                                班级:{{m[3]}}
                                <hr />
                                {% endfor %}
                                <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#update_password">
                        修改密码
                    </button>&nbsp; <a href="\" class="btn btn-danger btn-sm">登出</a>

                            </div>

                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="update_password" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="myModalLabel">修改密码</h4>
                        </div>
                        <div class="modal-body">
                            <form role="form" method="post" id="lc_up_pass">
                                <div class="form-group">
                                    <label for="password1">密码</label>
                                    <input type="password" class="form-control" id="password1" name="password1" placeholder="">
                                </div>
                                <div class="form-group">
                                    <label for="password2">确认密码</label>
                                    <input type="password" class="form-control" id="password2" name="password2" placeholder="">
                                </div>
                                <div>
                                    <button type="button" class="btn btn-default" onclick="up_ps()">
                                        确认
                                    </button>
                                    <button type="button" class="btn btn-default" data-dismiss="modal">
                                        关闭
                                    </button>
                                </div>
                            </form>
                        </div>
                        <div class="modal-footer">
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>

    <!-- LOGO HEADER END-->
    <section class="menu-section">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <div class="navbar-collapse collapse ">
                        <ul id="menu-top" class="nav navbar-nav navbar-right">
                            <li><a  href="\check_class_details">开课信息查看</a></li>
                             <li><a class="menu-top-active" href="\check_students_grades">成绩管理</a></li>
                        </ul>
                    </div>
                </div>

            </div>
        </div>
    </section>
    <!-- MENU SECTION END-->
    <div class="content-wrapper">
        <div class="container">
            <form method="get" action="/see_students">
                <label>已开设的课程：</label>
                <select class="btn btn-info dropdown-toggle" name="his_class" style="with:30%;">
                    {% for a in courses %}
                    <option value="{{a[1]}}">{{a[2]}}</option>
                    {% endfor %}
                </select>
                <input class="btn btn-primary btn-sm" type="submit" value="查询选择该课的学生" style="margin-left:100px;">
            </form>
            <form action="check_students_grades" enctype='multipart/form-data' method='POST'>
            <div class="row">
                <div class="col-md-12">
                    <h4 class="page-head-line">Dashboard</h4>
                    <!--<a href="\open_file">excel</a>-->

        <input  type="file" name="file" style="margin-top:20px;display:inline"/>
        <p class="help-block">请上传excel文件</p>
        <input class="btn btn-success" type="submit" value="导入学生成绩" class="button-new" style="margin-top:15px;"/>
                    <!--<a href="\check_class_details">点击</a>-->
                </div>

            </div>
                </form>
            <form action="confirm_grades" enctype='multipart/form-data' method='POST'>
            <div class="row">
                <p name="cno" id="cno">课程号:{{cno}}</p>
                <div>
                    <hr />
                     <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover">
                                        <tr>
                                            {% for a in fields %}
                                            <th>{{a}}</th>
                                            {% endfor %}
                                            <th> 录入成绩</th>
                                            <!--<th>分数</th>-->
                                        </tr>
                                        {%for item in datas%}
                                        <tr>

                                            {%for a in item%}
                                            <td>{{a}}</td>
                                            {% endfor %}
                                            <td><input name="{{item[0]}}" type="text" class="form-control"></td>
                                        </tr>
                                        {% endfor %}
                                </table>
                            </div>
                </div>
            </div>
                <input class="btn btn-success" type="submit" value="确认录入成绩">
            </form>
        </div>
    </div>
    <footer>
    </footer>
    <script src="static/js/jquery-1.11.1.js"></script>
    <script src="static/js/bootstrap.js"></script>
<script type="text/javascript">
function up_ps(){
    var p1=document.getElementById("password1").value;
    var p2=document.getElementById("password2").value;
    var username=document.getElementById('adm_username').innerText;
    var form= new FormData(document.getElementById("lc_up_pass"));
    form.append('username',username)
    if(p1!=p2){
        alert("两次密码不相同。");
        return true;
    }
    $.ajax({
            url:"{{ url_for('cg_lcy_up_pas') }}",
            type:"post",
            data:form,
            processData:false,
            contentType:false,
            success:function(dat){
                if(dat.flag){
                    alert("更新成功");
                }else{
                    alert("更新失败");
                }
            },
            error:function(e){
                    alert("error");
            }
        })
    return true;
}
</script>
</body>
</html>
